﻿using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

namespace LDriver.Protocols
{
    public class LidarSurvey: ISurvey
    {
        public int Quality = 0;
        public int S = 0;
        public double Angle = 0;
        public int C = 0;
        public double Distance = 0;
        

        public override MemoryStream Serialize()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(LidarSurvey));

            var stream = new MemoryStream();
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("","");
            serializer.Serialize(stream , this, ns);
            return stream;

        }


        public override string ToString()
        {
            //return string.Format("{0}: {1} - {2} ({3})", DateTime.Now, Angle, Distance, Quality);
            byte[] b = Serialize().ToArray();
            return Encoding.UTF8.GetString(b);
        }

    }

}
